package artid.com.arttogoa;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.TextView;

import org.apache.commons.lang3.StringUtils;

import artid.com.arttogoa.R;

/**
 * 
 *    
 * 项目名称：ArtworkArtA   
 * 类名称   ：EditSize_Activity   
 * 类描述   ：编辑尺寸   
 * 创建人   ：耿卫斌   
 * 创建时间：2016-7-19 下午2:01:00   
 *
 */
public class EditSize_Activity extends BaseActivity implements OnClickListener{
	private Context mContext;
	private EditText width_edit,height_edit;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_edit_size);
		setContent(this, getIntent());
		mContext=EditSize_Activity.this;
		initView();
	}

	private void initView(){
		TextView titleRight_tv=(TextView) findViewById(R.id.title_right);
		titleRight_tv.setText("保存");
		titleRight_tv.setVisibility(View.VISIBLE);
		titleRight_tv.setOnClickListener(this);
		mTittle.setText("尺寸");
		setBack();
		width_edit=(EditText) findViewById(R.id.editSize_width_edit);
		if(!StringUtils.isEmpty(getIntent().getStringExtra("width"))){
			width_edit.setText(getIntent().getStringExtra("width"));
		}
		height_edit=(EditText) findViewById(R.id.editSize_height_edit);
		if(!StringUtils.isEmpty(getIntent().getStringExtra("height"))){
			height_edit.setText(getIntent().getStringExtra("height"));
		}
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.title_right:
			//保存
			Intent intent=new Intent();  
			intent.putExtra("width",width_edit.getText().toString());
			intent.putExtra("height",height_edit.getText().toString());
			setResult(RESULT_OK, intent);  
			finish();
			break;

		default:
			break;
		}
	}
}
